<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- 兼容性 -->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title>计划编制-关键节点计划列表</title>
    <script src="/scripts/boot.js"></script>
    <style>
        html,body{
            margin:0;padding: 0;border:0;width:100%;height:100%;overflow:hidden;
        }
        body{
            background: #ffffff!important;
            padding:20px;
        }
    </style>
</head>
<body>
<div class="title-list mb-20"><span class="title-listbg"></span><span>计划填报记录</span></div>
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;"  url="/planFeedBack/listByPage" sizeList="[5,10,20,50]" pageSize="20"  idField="user_id" multiSelect="true" showEmptyText="true" emptyText="暂无数据" alwaysShowEmptyText="true">
        <div property="columns">
            <!--<div type="checkcolumn" headerAlign="center" align="center"></div>-->
            <div type="indexcolumn" headerAlign="center" align="center">编号</div>
            <div field="currentProgress" width="120" headerAlign="center" align="center" allowSort="true">进度</div>
            <div field="createDate" width="120" headerAlign="center" align="center" allowSort="true"  renderer="ondayRenderer" dateFormat="yyyy-MM-dd" >汇报时间</div>
            <div field="createName" width="120" headerAlign="center" align="center" allowSort="true">汇报人</div>
            <div field="completeIns" width="120" headerAlign="center" allowSort="true">说明</div><!-- 
            <div field="status" width="120" headerAlign="center" align="center" allowSort="true">状态</div> -->
            <div name="action" width="200" headerAlign="center" align="center">操作</div>
        </div>
    </div>
</div>
<div class="chose-toolbar">
    <a class="chose-button" onclick="CloseWindow('close')">关闭</a>
</div>
<script type="text/javascript">
    var view = {
        //页面初始化
        init: function() {
            mini.parse();
            mini.get("datagrid1").on("drawcell", function (e) {
                var column = e.column;
                if (column.name == "action") {
                    e.cellHtml = '<a class="check-botton" href="javascript:view.view()">详情</a>';
                }

                if(column.field=="currentProgress"){
                    e.cellHtml = e.row.currentProgress+'%';
                }
            })
        },
        //    新增或编辑
        addOrEdit: function (opt) {
            mini.open({
                url: "/program/keyPoint/new.html",
                title: (opt=="edit"?"编辑":"新增")+"计划申请", width: 1100, height: 700,
                onload: function () {
                    if(opt=="edit"){
                        var row = mini.get("datagrid1").getSelected();
                        var data = {"id": row.id,"state":opt};
                    }else{
                        var data = {"state":opt};
                    }
                    var iframe = this.getIFrameEl();
                    iframe.contentWindow.view.SetData(data);
                },
                ondestroy: function (action) {
                    mini.get("datagrid1").reload();
                }
            });
        },
        //    查看
        view: function(){
            var row = mini.get("datagrid1").getSelected();
            if (row) {
                mini.open({
                    url: "/program/monthlyPlan/recordview.html",
                    title: "计划填报信息", width: 1100, height: 700,
                    onload: function () {
                        var iframe = this.getIFrameEl();
                        var data = {"id": row.id};
                        iframe.contentWindow.view.SetData(data);
                    },
                    ondestroy: function (action) {
                        mini.get("datagrid1").reload();
                    }
                });

            } else {
                alert("请选中一条记录");
            }
        },
        SetData: function (data) {
            data = mini.clone(data);
        	mini.get("datagrid1").load({"planNode.id":data.id});
        },
       
        //    删除
        remove: function () {
            var row = mini.get("datagrid1").getSelected();
            if (row) {
                mini.confirm("确定删除选中记录？","确定",function (action) {
                    if(action=="ok"){
                        $.ajax({
                            url: "/messageRemind/del",
                            type : "post",
                            data:{"id":row.id},
                            success: function (text) {
                                if (text.state) {
                                    mini.get("datagrid1").reload();
                                } else {
                                    mini.showMessageBox({
                                        showModal: false,
                                        width: 250,
                                        title: "提示",
                                        iconCls: "mini-messagebox-warning",
                                        message: text.message,
                                    });

                                }
                            }
                        });
                    }
                });
            } else {
                alert("请选中一条记录");
            }
        }
    };
    view.init();
</script>
</body>
</html>